/**
 * 
 */
package bingo.validation.validator;

import bingo.validation.ValidationException;
import bingo.validation.ValidationResult;
import bingo.validation.annotations.AnnotationValidator;
import bingo.validation.annotations.NotBlank;

public class NotBlankValidator extends AnnotationValidator<NotBlank> {
	
	public NotBlankValidator(){
		this.setMessage("'{name}'不能为空");
	}

	@Override
	protected ValidationResult doValidate(Object objectToValidate, Object valueToValidate) throws ValidationException {
		if(null == valueToValidate || valueToValidate.toString().trim().equals("")){
			return ValidationResult.notPass(formatMessage());
		}else{
			return ValidationResult.pass();
		}
	}
}
